package org.soarsky.wealthchengdu.google.map;

import android.content.Context;
import android.graphics.Point;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Projection;



public class AbstractGoogleMap extends AbstractMapContorl{
    
	private MapView mapView = null;
	private MapController controller = null;
	private Projection projection=null;
	public AbstractGoogleMap(Context context,MapView mapView){
		super(context);
		if(null==mapView)return;
    	this.mapView = mapView;
    	controller = mapView.getController();
    	projection = mapView.getProjection();
    }
	@Override
	public void init() {
		// TODO Auto-generated method stub
		super.init();
		super.getMapOverlaysControlFactory().initGoogleOverlays(mapView);
		//super.init();
	}

	@Override
	public void setZoom(int zoomLevel) {
		// TODO Auto-generated method stub
		//super.setZoom(zoom);
		controller.setZoom(zoomLevel);
	}


	@Override
	public int getMaxZoomLevel() {
		// TODO Auto-generated method stub
		return mapView.getMaxZoomLevel();
	}

	@Override
	public int getZoomLevel() {
		// TODO Auto-generated method stub
		return mapView.getZoomLevel();
	}

	@Override
	public int getMiniZoomLevel() {
		// TODO Auto-generated method stub
		return super.getMiniZoomLevel();
	}

	@Override
	public void setTraffic(boolean on) {
		// TODO Auto-generated method stub
		mapView.setTraffic(on);
	}

	@Override
	public void setStreetView(boolean on) {
		// TODO Auto-generated method stub
		mapView.setStreetView(on);
	}

	@Override
	public void setSatellite(boolean on) {
		// TODO Auto-generated method stub
		mapView.setSatellite(on);
	}

	@Override
	public boolean isSatellite() {
		// TODO Auto-generated method stub
		return mapView.isSatellite();
	}

	@Override
	public boolean isTraffic() {
		// TODO Auto-generated method stub
		return mapView.isTraffic();
	}

	@Override
	public boolean isStreetView() {
		// TODO Auto-generated method stub
		return mapView.isStreetView();
	}
	@Override
	public void invalidate() {
		// TODO Auto-generated method stub
		mapView.invalidate();
	}
	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
	}
	/*附加方法 */
	public GeoPoint  fromPixels(int x, int y) {
		return projection.fromPixels(x, y);
	}
	
	public void toPixels(GeoPoint in, Point out) {
		projection.toPixels(in, out);
	}

	/*用于移动某坐标到中心点位置*/
	public void animateTo(GeoPoint point) {
		controller.animateTo(point);
	}
	
	public void setCenter(GeoPoint point) {
		controller.setCenter(point);
	}
	public MapView getMapView(){
		return mapView;
	}


}
